package com.geeguo.ebuilder.operation.business.system.organization.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.geeguo.ebuilder.operation.business.system.organization.model.OrganizationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrganizationMapper extends BaseMapper<OrganizationEntity> {

    List<OrganizationEntity> list();
    List<OrganizationEntity> listAllValid();
    List<OrganizationEntity> listChildren(String code);

    List<String> listChildrenIds(String code);

    String getMaxCode(@Param("code") String code, @Param("depth") Integer depth);
    Integer getMaxSequence(@Param("parentId") String parentId);
    Integer getChildCount(@Param("id") String id);

    Integer updateByParams(@Param("params") Map<String, Object> changeValues);
    Integer updateCode(@Param("id") String id, @Param("code") String code, @Param("depth") Integer depth, @Param("modifyTime") Date modifyTime, @Param("modifyUser") String modifyUser);

    Integer isUsed(String id);
}